package com.fast.controller;

import com.fast.pojo.req.UploadFileRequest;
import com.fast.pojo.AjaxResult;
import com.fast.service.FilesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author ruan cai yuan
 * @version 1.0
 * @fileName com.fast.controller.FilesController
 * @description: TODO
 * @since 2024/6/22 2:14
 */
@RestController
@Slf4j
@RequestMapping(value = "/files")
@Validated
public class FilesController {
    @Resource
    private FilesService filesService;

    @PostMapping(value = "/uploadFile")
    public AjaxResult uploadFile(@Validated @RequestBody UploadFileRequest request) {
        return AjaxResult.success(filesService.upload(request));
    }

}
